﻿<%@ Page Title="" Language="C#" MasterPageFile="~/skin.Master" AutoEventWireup="true" CodeBehind="Temp.aspx.cs" Inherits="DataShow.scene.Temp" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="headers" ContentPlaceHolderID="home_header" runat="server">
    <link rel="stylesheet" href="/css/compiled/form-showcase.css" type="text/css" media="screen" />
    <link href="/css/lib/bootstrap.datepicker.css" type="text/css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cph_home" runat="server">
    <div style="margin-top: 10px;">
        <ul class="breadcrumb">
            <li><a href="<%:URL %>">首页</a> <span class="divider">/</span></li>
            <li class="active">气温实况</li>
        </ul>
    </div>
    <div class="row-fluid">
        <div class="span3">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-plus"></i>
                    </span>
                    <h5>加载条件</h5>
                </div>
                <div class="widget-content nopadding">
                    
                    <h4>日期选择</h4>
                    <div class="field-box">
                        <label>开始日期:</label>
                        <asp:TextBox runat="server" ID="time_begin" CssClass="input-large datepicker"  />
                    </div>
                    <div class="field-box">
                        <label>结束日期:</label>
                        <asp:TextBox runat="server" ID="time_end" CssClass="input-large datepicker"  />
                    </div>
                    <hr />
                    <h4 class="inline">类型</h4><br />
                    <asp:CheckBox runat="server" ID="cbx_type_all" Text="全选" ClientIDMode="Static" />
                    <asp:CheckBoxList ID="cbl_types" runat="server" RepeatColumns="2" RepeatDirection="Horizontal" RepeatLayout="Table" CssClass="types">
                        <asp:ListItem Text="08-08高温" Value="D18" />
                        <asp:ListItem Text="08-08低温" Value="D8" />
                        <asp:ListItem Text="20-20高温" Value="D12" />
                        <asp:ListItem Text="20-20低温" Value="D2" />
                    </asp:CheckBoxList>
                    <hr />
                    <h4 class="inline">站点</h4><br />
                    <asp:CheckBox runat="server" ID="cbx_station_all" Text="全选" ClientIDMode="Static"  />
                    <asp:CheckBoxList ID="cbl_sites" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" RepeatLayout="Table" CssClass="stations">
                        <asp:ListItem Text="连云港" Value="58044" />
                        <asp:ListItem Text="东海" Value="58036" />
                        <asp:ListItem Text="赣榆" Value="58040" />
                        <asp:ListItem Text="灌云" Value="58047" />
                        <asp:ListItem Text="灌南" Value="58048" />
                    </asp:CheckBoxList>
                    <asp:Button runat="server" ID="btn_search" OnClick="btn_search_Click" CssClass="btn-primary btn" style="margin-top:10px" Text="搜索" Visible="true" />
                </div>
            </div>
        </div>
        <div class="span9">
            <div class="widget-box">
                <div class="widget-title">
                    <span class="icon">
                        <i class="icon-plus"></i>
                    </span>
                    <h5>加载结果</h5>
                </div>
                <div class="widget-content nopadding">
                    <asp:GridView runat="server" ID="gv_result" AutoGenerateColumns="false" EmptyDataText="暂无数据" CssClass="table" >
                        <Columns>
                            <asp:TemplateField HeaderText="日期">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbl_date" Text='<%#Eval("Time") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="类型">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbl_type" Text='<%#Eval("Type") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="站点">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbl_site" Text='<%#Eval("Station") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="实况">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbl_scene" Text='<%#Eval("Temp") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <div class="alert" id="div_nodata" runat="server">
                        <i class="icon-warning-sign"></i>
                        所选条件暂无数据
                    </div>
                    <webdiyer:AspNetPager ID="anp" runat="server" 
                        FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" OnPageChanged="anp_PageChanged"
                        PrevPageText="上一页" ShowCustomInfoSection="Left" ShowPageIndexBox="Never" CustomInfoHTML="第%CurrentPageIndex%页，共%PageCount%页，第页显示%PageSize%条"
                        CssClass="paginator" CurrentPageButtonClass="cpb" AlwaysShow="True" CustomInfoSectionWidth="250px">
                    </webdiyer:AspNetPager>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content runat="server" ID="scripts" ContentPlaceHolderID="home_script">
    <script src="/js/bootstrap.datepicker.js"></script>
    <script type="text/javascript">
        $(function () {

            // datepicker plugin
            $('.datepicker').datepicker({format:'yyyy-mm-dd'}).on('changeDate', function (ev) {
                $(this).datepicker('hide');
            });

        });
        $("#cbx_type_all").click(function () {
            if (this.checked) {
                $(".types input[type='checkbox']").each(function () {
                    this.checked = true;
                })
            }
            else {
                $(".types input[type='checkbox']").each(function () {
                    this.checked = false;
                })
            }
        })

        $(".types input[type='checkbox']").click(function () {
            var all = true;
            $(".types input[type='checkbox']").each(function () {
                if (!this.checked) {
                    all = false;
                }
            })
            if (all) {
                document.getElementById("cbx_type_all").checked = true;
            } else {
                document.getElementById("cbx_type_all").checked = false;
            }
        })


        $("#cbx_station_all").click(function () {
            if (this.checked) {
                $(".stations input[type='checkbox']").each(function () {
                    this.checked = true;
                })
            }
            else {
                $(".stations input[type='checkbox']").each(function () {
                    this.checked = false;
                })
            }
        })

        $(".stations input[type='checkbox']").click(function () {
            var all = true;
            $(".stations input[type='checkbox']").each(function () {
                if (!this.checked) {
                    all = false;
                }
            })
            if (all) {
                document.getElementById("cbx_station_all").checked = true;
            } else {
                document.getElementById("cbx_station_all").checked = false;
            }
        })
    </script>
</asp:Content>
